﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.DomainModels.ProductionManagement;
using VOL.Smartmanufacturing.Infrastructure;
using VOL.Smartmanufacturing.IServices.ProductionManagement;

namespace VOL.Smartmanufacturing.Services.ProductionManagement
{

    /// <summary>
    /// 批量删除设备台账
    /// </summary>
    public class BatchDeleteEquipmentLedger : IBatchDeleteEquipmentLedger
    {
        private readonly IBaseRepository<EquipmentLedgerModel> _batchDeleteRepo;

        public BatchDeleteEquipmentLedger(IBaseRepository<EquipmentLedgerModel> batchDeleteRepo)
        {
            _batchDeleteRepo = batchDeleteRepo;
        }
        public async Task<int> BatchDeleteEquipmentLedgerAsync(string ids)
        {
            var arrid = ids.Split(',');
            var result = 0;
            foreach (var id in arrid)
            {
                result = await _batchDeleteRepo.DelAll(a => a.Id == Convert.ToInt32(id));
            }
            return await Task.FromResult(result);
        }
    }

}
